﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace SchoolAuthentication
{
    public partial class RegisterPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void RegisterButton_Click(object sender, EventArgs e)
        {
            if (TextBoxPassword.Text != TextBoxRepeatPassword.Text)
            {
                LabelError.Text = "Passwords do not match!";
            }
            else
            {
                Membership.CreateUser(TextBoxUsername.Text, TextBoxPassword.Text);
                Roles.AddUserToRole(TextBoxUsername.Text,"Students");
                LabelError.Text = "Registration successfull";
            }
        }
    }
}